<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />

	<!--360浏览器优先以webkit内核解析-->

	<title>H+ 后台主题UI框架 - 主页示例</title>

	<link rel="shortcut icon" href="favicon.ico" />
	<link rel="stylesheet" href="static/js/plugins/layui/css/layui.css">
	<link href="static/css/bootstrap.min.css?v=3.3.7" rel="stylesheet" />
	<link href="static/css/font-awesome.css?v=4.4.0" rel="stylesheet" />
	<link href="static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
	<link href="static/css/animate.css" rel="stylesheet" />
	<link href="static/css/style.css?v=4.1.0" rel="stylesheet" />
	<link rel="stylesheet" href="../src/main/webapp/static/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../src/main/webapp/static/css/public.css" media="all">
	<style>
		.ibox-title {
			min-height: 15px;
		}

		.ml_20 {
			margin-left: 20px;
		}

		.w100 {
			width: 100px !important;
		}

		.mt-60 {
			margin-top: -60px;
		}
	</style>
</head>

<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form role="form" class="form-inline">
							<div class="form-group">
								<label for="p_name" class="">商品名称:</label>
								<input type="text" id="p_name" name="p_name" class="form-control">
							</div>
							<div class="form-group" id="grounding_date">
								<label for="grounding_date_from" class="ml_20">上架时间:</label>
								<input type="text" id="grounding_date_from" name="grounding_date_from"
									class="form-control w100">&nbsp;~
								<input type="text" id="grounding_date_to" name="grounding_date_to"
									class="form-control w100">
							</div>
							<button class="btn btn-white" type="button" id="search">查询</button>
						</form>
					</div>
				</div>
			</div>
		</div>
		
	</div>

	<div class="wrapper wrapper-content animated fadeInRight mt-60">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					
					<div class="ibox-content">
						
						<table class="layui-hide" id="test" lay-filter="currentTableFilter"></table>
					</div>
					
				</div>
				
			</div>
			
		</div>
		
	</div>

	<!-- 全局js -->
	<script src="static/js/jquery.min.js?v=2.1.4"></script>
	<script src="static/js/bootstrap.min.js?v=3.3.7"></script>
	<script src="static/js/plugins/layer/layer.min.js"></script>
	<script src="static/js/plugins/layui/layui.js"></script>


	<!-- 自定义js -->
	<script src="static/js/content.js"></script>




	<!-- Peity -->
	<script src="static/js/demo/bootstrap-table-demo.js"></script>

	<!-- 欢迎信息 -->
	<script src="static/js/welcome.js"></script>

<<<<<<< Updated upstream
<!--	<script type="text/html" id="checkboxTpl">-->
<!--		&lt;!&ndash; 这里的 checked 的状态只是演示 &ndash;&gt;-->
<!--&lt;!&ndash;	<input type="checkbox" name="lock" value="{{d.id}}" title="锁定" lay-filter="lockDemo" {{ d.id==10006 ? 'checked' : ''&ndash;&gt;-->
<!--&lt;!&ndash;		}}>&ndash;&gt;-->
<!--&lt;!&ndash;	</script>&ndash;&gt;-->

	<script type="text/html" id="barDemo">
		<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
		<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
=======
	<script type="text/html" id="checkboxTpl">
		<!-- 这里的 checked 的状态只是演示 -->
	<input type="checkbox" name="lock" value="{{d.id}}" title="锁定" lay-filter="lockDemo" {{ d.id==10006 ? 'checked' : ''
		}}>
	</script>
	<script type="text/html" id="toolbarDemo">
		<div class="layui-btn-container">
			<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 添加 </button>
			<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"> 删除 </button>
		</div>
>>>>>>> Stashed changes
	</script>
	<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
	<script type="text/html" id="currentTableBar">
		<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
		<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
	</script>
	<script src="../src/main/webapp/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
	<script>
		layui.use(['laydate', 'table'], function () {
			let laydate = layui.laydate;
			let table = layui.table;
			form = layui.form,
			laydate.render({
				elem: '#grounding_date',
				toolbar: '#toolbarDemo'
				//设置开始日期、日期日期的 input 选择器
				//数组格式为 2.6.6 开始新增，之前版本直接配置 true 或任意分割字符即可
				, range: ['#grounding_date_from', '#grounding_date_to']
			});

			


			table.render({
				elem: '#test',
				toolbar:'#toolbarDemo'
				, cols: [[ //标题栏
						{type: "checkbox", width: 50}
					,	{ field: 'id', title: 'ID', width: 80, sort: true }
					, { field: 'username', title: '用户名', width: 120 }
					, { field: 'email', title: '邮箱', minWidth: 150 }
					, { field: 'sign', title: '签名', minWidth: 160 }
					, { field: 'sex', title: '性别', width: 80 }
					, { field: 'city', title: '城市', width: 100 }
					, { field: 'experience', title: '积分', width: 80, sort: true }
					, { field: 'lock', title: '是否锁定', width: 110, templet: '#checkboxTpl', unresize: true }
					, { fixed: 'right', title: '操作', width: 125, minWidth: 125, toolbar: '#currentTableBar'}
				]]
				, data: [{
					"id": "10001"
					, "username": "杜甫"
					, "email": "test@email.com"
					, "sex": "男"
					, "city": "浙江杭州"
					, "sign": "人生恰似一场修行"
					, "experience": "116"
					, "ip": "192.168.0.8"
					, "logins": "108"
					, "joinTime": "2016-10-14"
				}, {
					"id": "10002"
					, "username": "李白"
					, "email": "test@email.com"
					, "sex": "男"
					, "city": "浙江杭州"
					, "sign": "人生恰似一场修行"
					, "experience": "12"
					, "ip": "192.168.0.8"
					, "logins": "106"
					, "joinTime": "2016-10-14"
					, "LAY_CHECKED": true
				}]
			})
			
		table.on('toolbar(currentTableFilter)', function (obj) {
			
            if (obj.event === 'add') {  // 监听添加操作
                let index = layer.open({
                    title: '添加用户',
                    type: 2,
                    shade: 0.2,
                    maxmin:true,
                    shadeClose: true,
                    area: ['100%', '100%'],
                    content: 'add.html',
                });
                $(window).on("resize", function () {
                    layer.full(index);
                });
            } else if (obj.event === 'delete') {  // 监听删除操作
                var checkStatus = table.checkStatus('currentTableId')
                    , data = checkStatus.data;
                layer.alert(JSON.stringify(data));
            }
       	});
		  
		table.on('tool(currentTableFilter)', function (obj) {
            let data = obj.data;
            if (obj.event === 'edit'){
                var index = layer.open({
                    title: '编辑用户',
                    type: 2,
                    shade: 0.2,
                    maxmin:true,
                    shadeClose: true,
                    area: ['100%', '100%'],
                    content: 'edit.html',
                });
                $(window).on("resize", function () {
                    layer.full(index);
                });
                return false;
            } else if (obj.event === 'delete') {
                layer.confirm('真的删除行么', function (index) {
                    obj.del();
                    layer.close(index);
                });
            }
        });
		table.on('checkbox(currentTableFilter)', function (obj) {
            console.log(obj)
        });
	});



		table.on('row(test)', function (obj) {
			//console.log(obj);
			//layer.closeAll('tips');
		});
		
		$("#search").click(function () {
			console.log($("#p_name").val());
			console.log($("#grounding_date_from").val());
			console.log($("#grounding_date_to").val());

			// 数据获取方式二
			console.log($("from").serialize());
		});

		//日期范围

	</script>
</body>

</html>